Previous Book Contents Next

Inside Macintosh: What's New in ColorSync 2.5 /


New Profile Locations

The following sections describe changes in the storage location for profiles in ColorSync 2.5.

Location of the ColorSync Profiles Folder

The ColorSync Profiles folder is now located in the System folder, rather than in the Preferences folder. This protects profiles from deletion should you accidentally or purposefully delete your Preferences folder. More importantly, placement in the System folder will allow the profiles folder to become a "magic" folder, providing the following benefits:

Important

Your application should continue to call ColorSync's CMGetColorSyncFolderSpec function to obtain the location of the profiles folder--it should not use a hard-coded path to a specific folder.

For backward compatibility, ColorSync automatically inserts into the new profiles folder an alias to the old location (inside the Preferences folder), if that folder exists and contains any profiles.

Profile Search Locations

With ColorSync 2.5, profile search routines look for profiles in the following locations:

With this new searching support, you can group profiles in subfolders within the profiles folder (one level of subfolders is currently allowed). For example, you might store all scanner profiles in one folder and a variety of monitor profiles for your primary monitor in another. You can also store aliases to other profiles and profile folders within the ColorSync Profiles folder. ColorSync search routines will find all profiles in the specified locations.

Where ColorSync Does Not Look for Profiles

Because profile searching can currently only go two levels deep, the ColorSync search routines will not find a profile in the following cases:

Temporarily Hiding a Profile Folder

To temporarily hide a folder from ColorSync's search path, put parentheses around the name of the folder or the alias to the folder.

Obtaining a Profile Location

ColorSync now provides the NCMGetProfileLocation function for obtaining a profile location. This function differs from its predecessor, the CMGetProfileLocation function, in that you now pass the size of the location structure to be filled in. You should use the newer version for the following reasons:

The NCMGetProfileLocation function is defined as follows:

pascal CMError NCMGetProfileLocation (
                     CMProfileRef prof,
                     CMProfileLocation * profLoc,
                     unsigned long * locationSize);

prof A profile reference of type CMProfileRef. Before calling NCMGetProfileLocation, you set the reference to specify the profile you wish to obtain the location for.

profLoc A pointer to a profile location structure, as described in .Advanced Color Imaging on the Mac OS. If you pass NULL , NCMGetProfileLocation returns the size of the profile location structure for the profile specified by prof in the locationSize parameter. If you instead pass a pointer to memory you have allocated for the structure, on return, the structure specifies the location of the profile specified by prof .

locationSize A pointer to a value of type long. If you pass NULL for the profLoc parameter, on return, locationSize contains the size in bytes of the profile location structure for the profile specified by prof . If you pass a pointer to a profile location structure in profLoc , set locationSize to the size of the structure before calling NCMGetProfileLocation .

function result A result code of type CMError . See Advanced Color Imaging on the Mac OS for a list of ColorSync-specific result code values.

DISCUSSION

The NCMGetProfileLocation function is available starting with ColorSync version 2.5. The best way to use NCMGetProfileLocation is to call it twice:

  1. Pass a reference to the profile to locate in the prof parameter and NULL for the profLoc parameter. NCMGetProfileLocation returns the size of the location structure in the locationSize parameter.
  2. Allocate enough space for a structure of the returned size, then call the function again, passing a pointer in the profLoc parameter; on return, the structure specifies the location of the profile.

It is possible to call NCMGetProfileLocation just once, using the constant cmCurrentProfileLocationSize for the size of the allocated profile location structure and passing the same constant for the locationSize parameter. The constant cmCurrentProfileLocationSize may change in the future, but will be consistent within the set of headers you build your application with. However, if the size of the CMProfileLocation structure changes in a future version of ColorSync and you do not rebuild your application, NCMGetProfileLocation may return an error.


Previous Book Contents Next